home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / strlib.zip / STRCMP.C < prev    next >
Text File  |  1993-01-04  |  768b  |  24 lines

  1.  
  2. /*  File   : strcmp.c
  3.     Author : Richard A. O'Keefe.
  4.     Updated: 10 April 1984
  5.     Defines: strcmp()
  6.  
  7.     strcmp(s, t) returns > 0, = 0,  or < 0  when s > t, s = t,  or s < t
  8.     according  to  the  ordinary  lexicographical  order.   To  test for
  9.     equality, the macro streql(s,t) is clearer than  !strcmp(s,t).  Note
  10.     that  if the string contains characters outside the range 0..127 the
  11.     result is machine-dependent; PDP-11s and  VAXen  use  signed  bytes,
  12.     some other machines use unsigned bytes.
  13. */
  14.  
  15. #include "strings.h"
  16.  
  17. int strcmp(s, t)
  18.     register char *s, *t;
  19.     {
  20.         while (*s == *t++) if (!*s++) return 0;
  21.         return s[0]-t[-1];
  22.     }
  23.  
  24.